//
//  ChanceQualityTableViewCell.m
//  图片故事
//
//  Created by 大帅逼 on 16/3/3.
//  Copyright © 2016年 helloApp. All rights reserved.
//

#import "ChanceQualityTableViewCell.h"
#import "Header.h"

#define MARGIN 20

@interface ChanceQualityTableViewCell ()

@property (nonatomic, strong) UIImageView *photoImageView;
@property (nonatomic, strong) UILabel *photoTitleLabel;

@end

@implementation ChanceQualityTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        //初始化控件
        _photoImageView = [[UIImageView alloc] init];
        
        [self.contentView addSubview:_photoImageView];
        
        _photoTitleLabel = [[UILabel alloc] init];
        
        [_photoTitleLabel setTextColor:[UIColor whiteColor]];
        
        [_photoTitleLabel setFont:[UIFont systemFontOfSize:14]];
        
        [self.contentView addSubview:_photoTitleLabel];
        
    }
    return self;
}

- (void)layoutSubviews {
    [super layoutSubviews];
    //设置控件位置
    [_photoImageView setFrame:CGRectMake(My_Width(10), My_Height(10), My_Height(40), My_Height(40))];
    
    [_photoTitleLabel setFrame:CGRectMake(My_Width(80), My_Height(MARGIN), SCREEN_W - My_Width(100), My_Height(20))];
    
}
- (void)setPhotoModel:(PhotoQualitModel *)photoModel {
    
    // 设置子控件数据
    _photoModel = photoModel;
    
    [_photoImageView setImage:[UIImage imageNamed:photoModel.photoImage]];
    
    [_photoTitleLabel setText:photoModel.photoTitle];
}

@end
